<?php
/* 
* @Author: LDF QQ 47121862
* @Date:   2014-06-10 10:16:05
* @Last Modified by:   LDF QQ 47121862
* @Last Modified time: 2014-06-12 17:41:21
*/
// 栏目文章列表
Class ListControl extends ConfigControl{
	function index(){
		$cid=Q('cid',0,'intval');
		$order=Q('order',0,'intval');
		switch ($order) {
			case '1': //按照评论最多
				$order = 'comments DESC';
				break;
			case '2': //按照喜欢最多
				$order = 'enjoys DESC';
				break;
			case '3': //按照最高评分
				$order = 'star DESC';
				break;
			case '4': //按照最新发布
				$order = 'addtime DESC';
				break;
			default:
				$order = 'comments DESC';
				break;
		}
		$total = M('article')->where(array('cid'=>$cid))->count();
		$page = new Page($total);
		$article = M('article')->where(array('cid'=>$cid))->limit($page->limit())->order($order)->all();
		//分类
		$this->total=$total;
		$this->page=$page->show();
		$this->article=$article;
		// p($article);
		$this->display();
	}
}